
package org.crspta.gohomenotes.web;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import org.crspta.gohomenotes.web.data.AToZDirectoriesImportData;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@RequestMapping("/import/**")
@Controller
public class ImportController {
    
    @RequestMapping(method = RequestMethod.POST, produces = "text/html")
    public String create(@Valid AToZDirectoriesImportData aToZDirectoriesImportData,
            BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {

//            CsvImportService aToZDirectoryImportService = new CsvImportService();
//            try {
//                aToZDirectoryImportService.buildPersonList(uploadItem.getFileData().getInputStream());
//            }
//            catch (IOException e) {
//                // TODO Auto-generated catch block
//                e.printStackTrace();
//            }
        
        return "redirect:/import/index/";
    }
    
    @RequestMapping
    public String index() {

        return "import/index";
    }
}
